<template>
  <div class="container">
    <div class="about" v-for="item in shoplist" :key="item.id" :data-shopid="item.id" :data-name="item.name" @tap="goDataAnalysis">
      <div class="version shop flex">
        <span class="flex-item">{{item.name}}</span>
        <span class="ver_words">
          <i class="grey_arrow"></i>
        </span>
      </div>
    </div>
  </div>
</template>

<script>
import api from '@/utils/api'
import wx from 'wx'
import Toast from '@/utils/toast'
export default {
  data () {
    return {
      windowHeight: 0,
      shoplist: []
    }
  },

  components: {
  },
  onLoad () {
    this.selectshop()
  },
  methods: {
    async selectshop () {
      let orcode = wx.getStorageSync('userInfo').orcode
      const res = await api.selectshop({ orcode: orcode });
      if (res) {
        if (res.code === '100') {
          this.shoplist = res.data
        } else {
          Toast(res.msg)
        }
      } else {
        Toast('接口错误！');
      }
    },
    goDataAnalysis (e) {
      console.log(e)
      let name = e.mp.currentTarget.dataset.name;
      let shopid = e.mp.currentTarget.dataset.shopid;
      this.$router.push({ path: '/pages/guest/dataAnalysis/dataAnalysis', query: { name: name, shopid: shopid } });
    }
  },
  created () {
    let that = this
    // 调用应用实例的方法获取全局数据
    // this.getUserInfo()
    wx.getSystemInfo({
      success (res) {
        that.windowHeight = res.windowHeight
      }
    })
  },
  onReady () {
  }
}
</script>

<style scoped>
.container {
  background: RGBA(153, 153, 153, 0.1) !important;
}
.about {
  width: 100%;
  background: #fff url("http://mytimg.178mr.com/aboutmyt@3x.png") no-repeat;
  background-position: 44rpx 28rpx;
  background-size: 32rpx 32rpx;
  padding-left: 108rpx;
  padding-right: 44rpx;
  border-bottom: 2rpx solid RGBA(153, 153, 153, 0.1);
}
.version {
  width: 100%;
  height: 84rpx;
  font-size: 32rpx;
  font-weight: 400;
  line-height: 84rpx;
  color: rgba(51, 51, 51, 1);
}
.ver_words {
  font-size: 28rpx;
  color: rgba(153, 153, 153, 1);
}
.grey_arrow {
  display: inline-block;
  width: 12rpx;
  height: 28rpx;
  background: url(http://mytimg.178mr.com/grey_arrow.png) no-repeat;
  background-size: 100%;
  position: relative;
  top: 6rpx;
  margin-left: 30rpx;
}
</style>
